1 Public Class FrmDEFFECTIVE_RETURN_STOCK_LIST
2 Private Sub FrmDEFFECTIVE_RETURN_STOCK_LIST_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
3 'MsgBox(FrmDEFFECTIVE_RETURN_ADD.txtpo.Text)
4 'MsgBox(FrmDEFFECTIVE_RETURN_ADD.txtpo2.Text)
5 sqlSTR = "SELECT DISTINCT TBL_Deffective_PO_Details.Item_ID as 'Item ID', TBL_Deffective_PO_Details.Purchase_Detail_ID as 'Detail ID', " & _
6 "Replace(Replace(TBL_Category_Item_File.Item_Name,'$.$',''''),'$..$',',') as 'Name', TBL_Purchase_Detail.Item_QTY as 'Current QTY', " & _
7 "TBL_Purchase_Detail.Item_Price as 'Price', TBL_Category_Item_File.Item_Barcode as 'Barcode', " & _
8 "TBL_Deffective_PO_Details.Def_QTY as 'Deffective Qty', TBL_Deffective_PO_Details.Unit as 'Measure' " & _
9 "FROM (((TBL_Deffective_PO_Details " & _
10 "INNER JOIN TBL_Category_Item_File ON TBL_Deffective_PO_Details.Item_ID = TBL_Category_Item_File.Item_ID) " & _
11 "INNER JOIN TBL_Deffective_PO ON TBL_Deffective_PO_Details.Purchase_ID = TBL_Deffective_PO.Purchase_ID " & _
12 "AND TBL_Deffective_PO.DEF_PO_ID = TBL_Deffective_PO_Details.DEF_PO_ID ) " & _
13 "INNER JOIN TBL_Purchase_Detail ON TBL_Deffective_PO_Details.Purchase_ID = TBL_Purchase_Detail.Purchase_ID " & _
14 "AND TBL_Deffective_PO_Details.Item_ID = TBL_Purchase_Detail.Item_ID) " & _
15 "WHERE TBL_Deffective_PO.DEF_PO_ID =" & FrmDEFFECTIVE_RETURN_ADD.txtpo.Text & _
16 " AND TBL_Deffective_PO_Details.Purchase_Detail_ID NOT IN " & _
17 "(SELECT Purchase_Detail_ID FROM TBL_Deffective_PO_Return_Details WHERE Return_ID =" & FrmDEFFECTIVE_RETURN_ADD.txtpo.Text & " AND Purchase_ID= " & FrmDEFFECTIVE_RETURN_ADD.txtpo2.Text & ")" & _
18 " AND TBL_Deffective_PO_Details.DEF_QTY > 0"
19
20 FillListView(ExecuteSQLQuery(sqlSTR), lstitems, 1)
21 End Sub
22
23 Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
24 Me.Close()
25 End Sub
26
27 Private Sub cmdselect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdselect.Click
28 With FrmDEFFECTIVE_RETURN_STOCKS_DATA_ADD
29 If Me.lstitems.Items.Count > 0 Then
30 Me.lstitems.Focus()
31 .txtid.Text = Me.lstitems.FocusedItem.Text
32 .txtdtl.Text = Me.lstitems.FocusedItem.SubItems(1).Text
33 .txtname.Text = Me.lstitems.FocusedItem.SubItems(2).Text
34 .txtdesc.Text = Me.lstitems.FocusedItem.SubItems(3).Text
35 .txtprice.Text = Me.lstitems.FocusedItem.SubItems(4).Text
36 .txtbarcode.Text = Me.lstitems.FocusedItem.SubItems(5).Text
37 .txtdefqty.Text = Me.lstitems.FocusedItem.SubItems(6).Text
38 .txtunit.Text = Me.lstitems.FocusedItem.SubItems(7).Text
39 End If
40 Me.lstitems.Focus()
41 End With
42 Me.Close()
43 End Sub
44 End Class